const canvas = document.querySelector("#canvas");
const context = canvas.getContext("2d");
const image = new Image();
image.src = "./img.png";
image.onload = e => {
    const pattern = context.createPattern(image, "repeat");

    context.fillStyle = pattern;
    context.fillRect(0, 0, canvas.width, canvas.height);
    context.fill();
};
